YUI.add("participantModel", function(Y) {
	
		var log = Y.log;
	
	 	function ParticipantModel(cfg ) { 
	 		if(cfg == null)
				return;
				
				
			this.addAttrs(Y.merge(ParticipantModel.ATTRIBUTES), cfg);
			
			var model = cfg["model"];
			if(model == null) 
				return;
				
			this.set("nickname" , model["nickname"] ); 
			this.set("GUID" , model["GUID"] +  DEBUG ? Math.floor(Math.random()*9999999999999999) : "" ); 
			this.set("userFlag" , model["userFlag"] ); 
			this.set("jTime" , model["jTime"] );  
			this.set('bigAvatarUrl' , "http://127.0.0.1/ChatWidget/assets/blank_avatar.jpg"); 
		} 
		
		ParticipantModel.ATTRIBUTES = {
		 	"nickname" : { 
	            value: "FPO : TEMP VALUE",
	 
	            getter: function(val, name) { 
	                return val ? val.substring(0,20) : val;
	            },
	 
	            validator: function(val, name) {
	                return Y.Lang.isString(val)  ;
	            }
	        },
	       "username" : { 
	            value: null 
	        },
	       "GUID" : { 
	            value: null
	        },
	       "userFlag" : { 
	            value: 0 
	        },
	        "jTime" : { 
	            value: "" 
	        },
	        "bigAvatarUrl" : { 
	            value: "http://127.0.0.1/ChatWidget/assets/blank_avatar.jpg" 
	        },
	        "smallAvatar" : { 
	            value: "http://127.0.0.1/ChatWidget/assets/blank_avatar.jpg"
	        }
		 };
		 
		 ParticipantModel.schema = {
    		metaFields: {status:"//status" , numUsers:"//numUsers" },
    		resultListLocator: "participant",
    		resultFields: [
    			{key:"userName", locator:"userName"},
    			{key:"GUID", locator:"GUID"},
    			{key:"userFlag", locator:"userFlag"},
    			{key:"nickname", locator:"nickname"},
				{key:"jTime", locator:"jTime"}   			 
    		]
    	};
		Y.augment(ParticipantModel, Y.Attribute); 	
	    Y.ParticipantModel = ParticipantModel;
	} , 1.0 , {requires:'attribute'});
 